﻿using Avalonia;
using Avalonia.Controls;
using DevManager.Services;
using DevManager.ViewModels.Pages;
using DevManager.Views;

namespace DevManager.Pages;

public partial class RunCodePage : UserControl
{
    public RunCodePage()
    {
        InitializeComponent();
        DataContext = new RunCodePageModel();
    }

    protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
    {
        base.OnAttachedToVisualTree(e);
        var mainView = ViewService.GetView<MainView>(this);
        if (mainView == null) return;
        DataContext = new RunCodePageModel(mainView.Info);
    }
}